package com.ctg.behavior.calc.impala.builder;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;

import org.springframework.stereotype.Component;

import com.ctg.behavior.common.properties.CtPropertyValuesCalcResult;

@Component
public class CtPropertyValuesBuilder {

	public CtPropertyValuesCalcResult doBuilder(CtPropertyValuesCalcResult calcResult, List<LinkedHashMap<String, Object>> queryResults) {

		calcResult.getValue().setTotal(queryResults.size());
		List<String> values = new ArrayList<>();
		for (LinkedHashMap<String, Object> oneRecodrd : queryResults) {
			values.add(String.valueOf(oneRecodrd.get("pname")));
		}
		calcResult.getValue().setList(values);

		return calcResult;
	}
}
